using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class SettingPanel : MonoBehaviour
{
    public AudioSource music;
    public Slider slider;
    public Button back;

    private void Awake()
    {
        MsgSignal.AddListener<bool>(EventConst.SettingPanel, IsShowPanel);
        this.gameObject.SetActive(false);
    }

    private void IsShowPanel(bool show)
    {
        this.gameObject.SetActive(show);
    }

    void Start()
    {
        back.onClick.AddListener(()=> {
            MsgSignal.Dispatch(EventConst.SettingPanel,false);
        });
    }

    public void WhenVoiceChanged()
    {
        music.volume = slider.value;
    }
    void Update()
    {
        
    }

    private void OnDestroy()
    {
        MsgSignal.RemoveListener<bool>(EventConst.SettingPanel, IsShowPanel);
    }
}
